package com.aaa.controller;

import com.aaa.entity.Menu;
import com.aaa.service.MenuService;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class MenuController {
    @Resource
    private MenuService menuService;
    //    查询用户能操作的菜单
    @RequestMapping("/listAllMenu")
    public List<Menu> listAllMenu(Authentication authentication){
        System.out.println(authentication.getPrincipal());
        return menuService.listMyMenus(Long.valueOf(authentication.getPrincipal().toString()));
    }
}
